package com.eugene.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.eugene.element.CurveBucket;
import com.eugene.util.HibernateUtil;

public class CurveBucketDao {
	private static List<CurveBucket> curveBuckets;
	
	public static List<CurveBucket> getCurveBuckets(){
		if (curveBuckets == null){
			curveBuckets = new ArrayList<CurveBucket>();
			Session s = HibernateUtil.currentSession();
			Query qr =s.createQuery("from CurveBucket");
			s.enableFilter("curveBucket").setParameter("isCurveBucket", "Y");
			curveBuckets=qr.list();
			return curveBuckets;
		}
		//System.out.println("call the exist reference");
		return curveBuckets;
	}
	
//	private static List<EMaturity> buckets;
//	public static List<EMaturity> getCurveBuckets(boolean mode){
//		if (buckets == null){
//			buckets = new ArrayList<EMaturity>();
//			Session s = HibernateUtil.currentSession();
//			Query qr =s.createQuery("from CurveBucket");
//			s.enableFilter("curveBucket").setParameter("isCurveBucket", "Y");
//			curveBuckets=qr.list();
//			return curveBuckets;
//		}
//		//System.out.println("call the exist reference");
//		return curveBuckets;
//	}

}
